﻿using MRGSP.SurveyMaster.Core.Model;
using MRGSP.SurveyMaster.Data;
using NUnit.Framework;

namespace MRGSP.SurveyMaster.Tests.Data
{
    [TestFixture]
    public class SurveyRepositoryTests : BaseRepoTest
    {
        readonly SurveyRepository repository = new SurveyRepository(new ConnectionFactory());
        readonly QuestionRepository qrepo = new QuestionRepository(new ConnectionFactory());

        [Test]
        public void GetCount()
        {
            repository.Count();
        }

        [Test]
        public void Insert()
        {
            Assert.IsTrue(repository.Insert("my survey".Survey()) > 0);
        }

        [Test]
        public void GetPage()
        {
            repository.GetPage(1, 1);
        }

        [Test]
        public void Delete()
        {
            var s = repository.Insert("sss".Survey());
            var q1 = qrepo.Insert(null, "q1", 1, s, false);
            var q2 = qrepo.Insert(q1, "q2", 1, s, false);
            qrepo.Insert(q2, "q3", 1, s, false);
        }
    }
}